/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Grabacion;
/**
 *
 * @author Jhon Jairo
 */
import Vista.configuracion.NameVideo;
import java.io.File;
import javax.sound.sampled.*;

public class RecordAudio {
    static AudioFileFormat.Type aFF_T = AudioFileFormat.Type.WAVE;
    static AudioFormat aF = new AudioFormat(44100, 16, 2, true, false);
    public static TargetDataLine tD;
    static File f = new File("audio.mp3");
    public RecordAudio() {
        try {
            System.out.println("nombreAudio= "+NameVideo.name.toString()+".mp3");
            DataLine.Info dLI = new DataLine.Info(TargetDataLine.class, aF);
            tD = (TargetDataLine) AudioSystem.getLine(dLI);
            new CapThread().start();
        } catch (Exception e) {
        }
    }

    public static class CapThread extends Thread {
        public void run() {
            try {
                tD.open(aF);
                tD.start();
                AudioSystem.write(new AudioInputStream(tD), aFF_T, f);
            } catch (Exception e) {
            }
        }
    }
}
